<template>
    <div>
        <div>
            <p>用户名：<input type="text" v-model="username"></p>
            <p>密码：<input type="password" v-model="password"></p>
            <p>老师或学生：<input type="text" v-model="userr"></p>
            <p><input type="button" value="登录" @click="deng()"></p>
        </div>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    name:'deng',
    data() {
        return {
            username:'',
            password:'',
            userr:''
        }
    },
    methods: {
        deng(){
            let fromdata = new FormData()
            fromdata.append('username',this.username)
            fromdata.append('password',this.password)
            fromdata.append('userr',this.userr)

            axios({
                url:'http://127.0.0.1:8000/zhouce/deng',
                method:'post',
                data:fromdata
            }).then(res=>{
                if(username == 1){
                    this.$router.push({path:'showxue'})
                }else{
                    this.$router.push({path:'showke'})
                }
            })
        }
    },
    created() {

    }
}
</script>

<style scoped>

</style>
